package com.atguigu.sort;

import com.atguigu.utils.ArrayGenerator;
import com.atguigu.utils.SortingHelper;
import org.junit.Test;

import java.util.Arrays;

public class ShellSortTest {

    public static void main(String[] args) {
        Integer[]arr={3,7,4,2,5,6,1,9};
        ShellSort.sort2(arr);
        System.out.println(Arrays.toString(arr));
    }
    @Test
    public void testOrder(){
        int n=100000;
        Integer[] array = ArrayGenerator.generateRandomArray(n, n);
        Integer[] array1=Arrays.copyOf(array,array.length);
        SortingHelper.sortTest("ShellSort",array);
        SortingHelper.sortTest("InsertionSort",array1);
    }
    @Test
    public void testSort(){
        int n=100000;
        Integer[] arr1 = ArrayGenerator.generateRandomArray(n, n);
        Integer[] arr2 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr3 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr4 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr5 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr6 = Arrays.copyOf(arr1,arr1.length);
        SortingHelper.sortTest("BubbleSort",arr1);
        SortingHelper.sortTest("MergeSort",arr2);
        SortingHelper.sortTest("QuickSort",arr3);
        SortingHelper.sortTest("InsertionSort",arr4);
        SortingHelper.sortTest("SelectionSort",arr5);
        SortingHelper.sortTest("ShellSort",arr6);
    }
    @Test
    public void testShelloSort3(){
        int n=5000000;
        Integer[]arr=ArrayGenerator.generateRandomArray(n,n);
        Integer[]arr1=Arrays.copyOf(arr,arr.length);
        SortingHelper.sortTest("ShellSort",arr);
        SortingHelper.sortTest("ShellSort3",arr1);

    }
}
